package com.lihuinch.ti4j.chap3.demo;

import java.util.Random;

/**
 * 测试是否同一个随机种子都会生成同一个随机数
 *
 * @author lihuinch
 * @date 2018/1/2
 */
public class RandomTest {
    public static void main(String[] args) {
        Random r;

        r = new Random(47);
        System.out.println(r.nextInt());
        System.out.println();

        r = new Random(47);
        System.out.println(r.nextInt());
        System.out.println();

        r = new Random(47);
        System.out.println(r.nextInt());
        System.out.println(r.nextInt());
        System.out.println(r.nextInt());
        System.out.println();

        r = new Random(47);
        System.out.println(r.nextInt());
        System.out.println(r.nextInt());
        System.out.println(r.nextInt());
        System.out.println();

    }
}
